package edu.fiu.cis.personalize.server.berkDB.serializers;

import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

import com.sleepycat.bind.tuple.TupleInput;
import com.sleepycat.bind.tuple.TupleOutput;

import edu.fiu.cis.personalize.server.graph.store.CountingConcMap;

public class CountingConcMapSerializer extends MapSerializer<Integer, AtomicInteger>{

	@Override
	protected Map<Integer, AtomicInteger> createInstance() {
		return new CountingConcMap();
	}

	@Override
	protected Integer readKey(TupleInput ti) {
		return ti.readInt();
	}

	@Override
	protected AtomicInteger readValue(TupleInput ti) {
		return new AtomicInteger(ti.readInt());
	}

	@Override
	protected void writeKey(TupleOutput to, Integer key) {
		to.writeInt(key);
	}

	@Override
	protected void writeValue(TupleOutput to, AtomicInteger value) {
		to.writeInt(value.get());
	}

}
